package com.wjh.controller;


import com.wjh.enums.AppHttpCodeEnum;
import com.wjh.exception.SystemException;
import com.wjh.service.BasemachineService;
import com.wjh.service.MachinedataService;
import com.wjh.updata.RequestVo;
import com.wjh.utils.ResponseResult;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("machine")
public class MachineController {

    @Resource
    private BasemachineService basemachineService;

    @PostMapping("/list")
    public ResponseResult getMachine(@RequestBody RequestVo requestVo){
        if(!StringUtils.hasText(requestVo.getMachineName())){
            throw new SystemException(AppHttpCodeEnum.NEED_NAME);
        }
        if(requestVo.getMachineId() == null){
            throw new SystemException(AppHttpCodeEnum.ID_NOTNULL);
        }
        return basemachineService.selectList();
    }
}
